package com.ruoyi.business.controller.user;

import com.ruoyi.business.service.DefaultLoginService;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.model.LoginBody;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * @author Tellsea
 * @date 2024/2/28
 */
@RestController
@RequestMapping("/au/defaultLogin")
@RequiredArgsConstructor
public class DefaultLoginController {

    private final DefaultLoginService defaultLoginService;

    @GetMapping("/beforeLogin")
    public AjaxResult beforeLogin() {
        return AjaxResult.success();
    }

    @ApiOperation("账号密码登录")
    @PostMapping("login")
    public AjaxResult login(@RequestBody LoginBody entity) {
        return defaultLoginService.login(entity);
    }
}
